import java.util.Arrays;
import java.util.Random;

public class Test {

    public static void order(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = i;
        }
    }

    public static void reverseOrder(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = array.length-i;
        }
    }

    public static void randomOrder(int[] array) {
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextInt(array.length);
        }
    }

    public static void testInserSort(int[] array){
        array = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort1.insertSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("直接插入排序耗时："+(endTime-startTime));
    }

    public static void testShellSort(int[] array){
        array = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort1.insertSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("希尔排序耗时："+(endTime-startTime));
    }

    public static void main1(String[] args) {
        int[] array = new int[1_0000];
        reverseOrder(array);

        testInserSort(array);

        testShellSort(array);
    }







    public static void main(String[] args) {
        int[] array = {81,12,31,4,15,6};
        //Sort1.selestSort(array);
//        Sort1.quickSort(array);
        Sort1.mergeSortNor(array);
        System.out.println(Arrays.toString(array));
    }

}
